#!/usr/bin/python3
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*-

import os
import re
import pathlib
from common_python import check_package_installed


check_package_installed({
    "gentoo": [
        "sys-apps/portage",
    ],
})

print("/etc/portage/***")
print("/etc/profile.env")
print("/etc/csh.env")
print("/etc/environment.d")
print("/etc/environment.d/10-gentoo-env.conf")

print("/var/db/pkg/***")

# read /etc/portage/make.conf and exclude
if True:
    buf = pathlib.Path("/etc/portage/make.conf").read_text()

    m = re.search(r'^DISTDIR="(.*)"$', buf, re.M)
    if m is not None:
        print(os.path.join(m.group(1), "***"))
    else:
        print("/var/cache/distfiles/***")

    m = re.search(r'^PKGDIR="(.*)"$', buf, re.M)
    if m is not None:
        print(os.path.join(m.group(1), "***"))
    else:
        print("/var/cache/binpkgs/***")

# read /etc/portage/repos.conf and exclude
if True:
    pass

print("/var/cache/edb/***")

print("/var/log/emerge-fetch.log")
print("/var/log/emerge.log")
print("/var/log/portage/***")
